package org.mall.modules.member.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.mall.modules.member.entity.MemberShopCollectionDO;
import org.mall.modules.member.mapper.MemberShopCollectionMapper;
import org.mall.modules.member.service.IMemberShopCollectionService;
import org.mall.modules.pojo.member.MemberShopCollectionBO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/***
 *@author yinxucun
 *@date 2019-12-28 13:50 
 */
@Service
public class MemberShopCollectionServiceImpl extends ServiceImpl<MemberShopCollectionMapper, MemberShopCollectionDO> implements IMemberShopCollectionService {
    @Resource
    private MemberShopCollectionMapper collectionMapper;
    @Override
    public IPage<MemberShopCollectionBO> getListByUserId(Page page, String userId) {
        return collectionMapper.getListByUserId(page,userId);
    }

    @Override
    public Boolean removeUserFavorite(String userId,String shopId) {
        return collectionMapper.removeUserFavorite(userId,shopId);
    }

    @Override
    public Boolean hasUserSpuFavorite(String userIdByToken, String shopId) {
        int num=collectionMapper.hasFavorite(userIdByToken,shopId);
        return num==1;
    }
}
